<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html>

<s:layout-render name="/backend/layout.jsp" title="moduleNames.reservations" selectedPage="hotels">
    <s:layout-component name="left-column">
        <h3><f:message key="global.menu" /></h3>
        <ul class="nav">
            <li><s:link beanclass="cz.muni.fi.pa165.bookingmanager.web.HotelActionBean" event="all"><f:message key="global.back_to_list" /> <f:message key="moduleNames.fourth_variant.hotels" /></s:link></li>        
        </ul>
    </s:layout-component>
    <s:useActionBean beanclass="cz.muni.fi.pa165.bookingmanager.web.ReservationActionBean" var="actionBean"/>   
    <s:layout-component name="body">
        <s:form beanclass="cz.muni.fi.pa165.bookingmanager.web.ReservationActionBean">
            
            <div class="select-bar">
                <table>
                    <tr>
                        <th class="full">
                            <label><f:message key="global.reservation.search.from" /></label>
                            <s:text size="20" id="datepicker2" name="dateFrom" formatType="date" formatPattern="MM/dd/yyyy"/>

                            <label><f:message key="global.reservation.search.to" /></label>
                            <s:text size="20" id="datepicker3" name="dateTo" formatType="date" formatPattern="MM/dd/yyyy"/>
                            
                            <label><f:message key="global.reservation.search.roomNumber_paramater" /></label>
                            <s:text size="20" name="searchedRoomNumber"/>
            
                            <s:submit name="findHotelReservationsFromTo"><f:message key="global.reservation.search" /></s:submit></th>
                    </tr>
                </table>
            </div>
        </s:form>
        <div class="table">           
            <table class="listing" cellpadding="0" cellspacing="0">
                <img src="${pageContext.request.contextPath}/backend/img/bg-th-left.gif" width="8" height="7" alt="" class="left" /> 
                <img src="${pageContext.request.contextPath}/backend/img/bg-th-right.gif" width="7" height="7" alt="" class="right" />                
                <tr>
                    <th class="first"><f:message key="global.hotel.reservations" /> ${actionBean.context.hotel.name}</th>                    
                </tr>
                <tr>
                    <th class="first"><f:message key="entities.reservation.customers" /></th>
                    <th><f:message key="entities.reservation.start_date" /></th>
                    <th><f:message key="entities.reservation.duration" /></th>
                    <th><f:message key="entities.reservation.total_price" /></th>
                    <th><f:message key="entities.reservation.PAID" /></th>  
                    <th><f:message key="entities.reservation.room" /></th>
                     <th><f:message key="global.edit" /></th>
                    <th class="last"><f:message key="global.delete" /></th>
                </tr>
              <c:forEach var="reservation" items="${actionBean.getList()}">
                <tr>  
                    <td class="first_style1" ><c:out value="${reservation.customers}"/></td>
                    <td><c:out value="${reservation.startDate}"/></td>                    
                    <td><c:out value="${reservation.duration}"/></td>
                    <td><c:out value="${reservation.totalPrice}"/> €</td>
       
                    <td><f:message key="entities.reservation.${reservation.isPaid()}"  /></td>
                    <td><c:out value="${reservation.room.roomNumber}"/></td>
                    <td><s:link beanclass="cz.muni.fi.pa165.bookingmanager.web.ReservationActionBean" event="edit"><s:param name="reservation.id" value="${reservation.id}" /><img src="${pageContext.request.contextPath}/backend/img/edit-icon.gif" /></s:link></td>
                    <td class="last"><s:link onclick="return confirm_delete()" beanclass="cz.muni.fi.pa165.bookingmanager.web.ReservationActionBean" event="delete"><s:param name="reservation.id" value="${reservation.id}" /><img src="${pageContext.request.contextPath}/backend/img/hr.gif" /></s:link></td>
                    
                </tr>
            </c:forEach>
           </table>                
           </div>      
                <s:form beanclass="cz.muni.fi.pa165.bookingmanager.web.ReservationActionBean">		
	               <c:import url="form.jsp">		
	                   <c:param name="header" value="global.add" />		
	               </c:import>		
	               <s:submit class="button" name="add"><f:message key="global.add" /></s:submit>		
	           </s:form>
                    
    </s:layout-component>
</s:layout-render>
